package com.company;
/**
 *
 */
public class DeamonThread {
    public static boolean flag = true;
    public static void main(String[] args) throws Exception {
        Thread user = new Thread(() -> {
            for(int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName() + " exec result:[ i = " + i + "]");
            }
        }, "thread of user");
        Thread deamon = new Thread(() -> {
            for(int i = 0; i < 100; i++) {
                System.out.println(Thread.currentThread().getName() + " exec result:[ i = " + i + "]");
            }
        }, "thread of deamon");
        user.start();
        deamon.setDaemon(true);
        deamon.start();
    }
}
